package com.raja.requestForwarding.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 登录控制器
 * Created by liuyanjun
 * on 2017/4/5.
 */
@Controller
public class LoginController {
    private static final Logger log = LoggerFactory.getLogger(LoginController.class);

    /**
     * 登录页
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/login",method = RequestMethod.GET)
    public String login(HttpServletRequest request, HttpServletResponse response){
        return "/login";
    }

    /**
     * 登出页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/logout",method = RequestMethod.GET)
    public String logout(HttpServletRequest request, HttpServletResponse response){
       return "logout";
    }
    /**
     * 登录页
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/",method = RequestMethod.GET)
    public String index(HttpServletRequest request, HttpServletResponse response){
        return "/login";
    }
    /**
     * 提交登录请求
     * @param request
     * @param response
     * @return
     */
//    @RequestMapping(value = "/login",method = RequestMethod.POST)
//    public String loginSystem(HttpServletRequest request, HttpServletResponse response){
//        request.getSession().setAttribute("_loginUser","aaaaaa");
//        return "/common/index";
//    }
    /**
     * 错误页面
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/error/403")
    public String error(HttpServletRequest request, HttpServletResponse response){
        return "/error/403";
    }
}
